<template>
<div>
<mt-button size="large" v-on:click="$router.push('/addaddress')" style="margin-top:-20px;">添加收货地址</mt-button>
<ul v-if="show">
    <li v-for="(item, index) in addressarr" :key="index" class="myaddress">
    <p>邮编：{{item.postcode}}收货人：{{item.username}}</p>
    <p>收获地址：{{item.area}}{{item.location}}</p>
    </li>
</ul>
<h2 v-if="!show" style="margin-top:50px;">未添加地址</h2>
</div>
</template>

<script>
export default {
  data() {
    return {
        addressarr:[],
        show:false
    }
  },methods: {
       
  },mounted() {
      if("addressarr" in localStorage){
      this.addressarr=JSON.parse(localStorage.addressarr)
      this.show=true
    }
  },
}
</script>

<style scoped>
.myaddress{
    text-align:left;
    box-sizing:border-box; 
    border:1px solid #999;
    font-size:15px;
    margin:10px;
    line-height:30px;
    padding:5px;
}
</style>